/*
 * @Author: AskMeWhy
 * @Date:   2020-05-22 09:10:37
 * @Last Modified by: AskMeWhy
 * @Last Modified time: 2020-12-30 22:44:29
 */
export default {
    handleCms(option) {
        let { shareId, taskId } = option;
        let cmsQueryString = "?categoryPid=10&&categoryId=20&taskId=" + taskId;
        if (shareId) {
            cmsQueryString += "&shareId=" + shareId;
        }
        let cmsUrl = "/pages/unpackage/artisan/index";
        wx.navigateToMiniProgram({
            appId: "wxb1e6760d43e482f8",
            path: cmsUrl + cmsQueryString,
            extraData: {},
            envVersion: "develop",
            success(res) {
                // 打开成功
                console.log("resSuccess", res);
            },
            fail(res) {
                // 打开失败
                console.log("resFail", res);
            },
        });
    },
    handleForm(option, type = "reLaunch") {
        let { isCms, taskId, shareId, line, id, sharePhone } = option;
        let _url = "/pages/task-form/index";
        let queryString = "?taskId=" + (taskId || "");
        queryString += "&isCms=" + (isCms === "1" ? 1 : 0);
        if(shareId){
            queryString += "&shareId=" + shareId;
        }
        if(sharePhone){
            queryString += "&sharePhone=" + sharePhone;
        }
        if(line){
            queryString += "&line=" + line;
        }
        if(id){
            queryString += "&id=" + id;
        }
        if(type){
            wx[type]({
                url: `${_url}${queryString}`,
            });
        }else{
            return _url + queryString;
        }
    },
};
